/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: app2022 - Arr1
 * <p>Powered by webrx On 2022-01-08 15:31:18
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Arr1 {
    public static void main(String[] args) {
        double[] ds = new double[3];
        //String有length方法.length(),Arrays有length属性.length
        System.out.println(ds.length);//3
        System.out.println(ds[1]); //0.0

        //声明字符串数组，并直接初始化。3个元素
        String[] ss = new String[]{"java", "hello", "mysql"};

        //声明int型的数组，长度为3，并初始化全部数据为0
        int[] a = new int[3]; // 0 1 2 三个 0
        a[1] = 100;
        System.out.println(a[0]);//0
        System.out.println(a[1]);//100
        System.out.println(a[2]);//0
        //a[3] = 20; 错误的，数组在java长度是固定

        //下边行是有异常的，
        System.out.println(a[3]);//数组下标是0 1 2 没有3
    }
}
